﻿using System;
using System.Collections.Generic;
using System.Text;

namespace YouMa.Model
{
    public class PageListBase<T> where T : class
    {
        public List<T> List { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageNum { get; set; }

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 页数
        /// </summary>
        public int PageCount
        {
            get
            {
                return PageSize > 0 ? TotalCount / PageSize + (TotalCount % PageSize > 0 ? 1 : 0) : 0;
                //if (每页记录数 >0)
                //{
                //    页数=总记录数/每页记录数(取整)+
                //         总记录数 %每页记录数（取余）>0?1:0
                //}
                //else { 页数 = 0; }
            }
        }
    }
}
